<template>
  <div class="page-main" :style="cssVars">

    <div class="finance-data">
      <div class="add-report">
        <el-button  @click="uploadFile" type="primary" icon="el-icon-plus">添加财报</el-button>
      </div>
      <div class="report-header">
        <div class="report-header-left">
          <ul class="search-list">
            <li class="search-item"
              :class="{ 'active': curfinType === item.code }"
              v-for="item in financeTypeEnum" :key="item.code"
              @click="clickFinType(item.code)">

              {{item.name}}
            </li>
          </ul>
        </div>
        <div class="report-header-right">
          <el-date-picker
            type="year"
            v-model="cbyear"
            placeholder="年度"
            @change="financeEventSearch">
          </el-date-picker>
          <el-select v-model="bgtypeCode" placeholder="全部" @change="financeEventSearch">
            <el-option key="all" label="全部" value="all"></el-option>
            <el-option
              v-for="item in financeRtTypeEnum"
              :key="item.code"
              :label="item.name"
              :value="item.code">
            </el-option>
          </el-select>
          <el-input placeholder="搜索财报名称" v-model="finceName" class="input-with-select">
            <el-button slot="append" icon="el-icon-search" @click="financeEventSearch"></el-button>
          </el-input>
        </div>
      </div>
      
      <el-table
        :data="pageInitData"
        style="width: 100%"
        ref="multipleTable"
        row-key="textinTaskId"
        :expand-row-keys="expandRow"
        @expand-change="expandChange"
        v-if="tableFlag">
        <el-table-column type="expand">
          <template>
            <div class="subdata-list">
              <ul class="search-list" v-if="curfinType==='all'">
                <li class="search-item"
                  v-if="subTableAllData[key]"
                  v-for="(item, key) in finNameList"
                  :class="{ 'active': subfinType === key }"
                  :key="key"
                  @click="clickSubFinType(key)">
                  {{item}}
                </li>
              </ul>
              <div class="table-list" v-if="hasSubTableData">
                <div class="table-title">
                  <div class="table-title-item" v-for="(item, index) in subTableData.headers" :key="index">
                    <span>{{item}}</span>
                  </div>
                </div>
                <div class="table-data" v-for="(item, index) in subTableData.dataList" :key="index">
                  <div class="table-data-item">
                    <span class="table-text">{{item.subject.name || item.subject.ocr}}</span>
                  </div>
                  <!-- <div class="table-data-item">
                    <span class="table-text">{{item.values[key+'_1'] && item.values[key+'_1'].verifyStr || '-'}}</span>
                  </div>
                  <div class="table-data-item">
                    <span class="table-text">{{item.values[key+'_2'] && item.values[key+'_2'].verifyStr || '-'}}</span>
                  </div> -->
                  <!-- fix：循环对象不定时的会出现不按key的顺序取值 所以暂时用上面每个key值列出来 -->
                  <div class="table-data-item" v-for="(subitem, subindex) in item.values" :key="subindex">
                    <span class="table-text">{{subitem.verifyStr || '-'}}</span>
                  </div>
                </div>
              </div>
              <div class="table-list-nodata" v-else>
                <p>正在加载数据......</p>
                <p>若未获取到请重新点击展开</p>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          label="编号"
          prop="number">
        </el-table-column>
        <el-table-column
          label="财报名称"
          prop="name">
        </el-table-column>
        <el-table-column
          label="创建时间"
          prop="createTime">
          <template slot-scope="scope">
           {{ parseTime(scope.row.createTime, 'YYYY-MM-DD hh:mm:ss') }}
          </template>
        </el-table-column>
        <el-table-column
          label="财报类型"
          prop="cbtype">
        </el-table-column>
        <el-table-column
          label="年度"
          prop="cbyear">
          <template slot-scope="scope">
           {{ parseTime(scope.row.cbyear, 'YYYY') }}
          </template>
        </el-table-column>
        <el-table-column
          label="报告期类型"
          prop="bgtypeVal">
        </el-table-column>
        <el-table-column
          label="上传格式"
          prop="bggsVal">
        </el-table-column>
        <el-table-column
          label="操作"
          width="100">
          <template slot-scope="scope">
            <el-button @click="editTableDate(scope.row)" type="text" size="small">编辑</el-button>
            <el-button @click="deleteTableDate(scope.row)" type="text" size="small">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        @size-change="handPaginationSize"
        @current-change="handPagination"
        :current-page="pageNum"
        :page-sizes="[5, 10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total=total>
      </el-pagination>

      <!-- 添加财报 -->
      <el-dialog
        class="add-report-dialog"
        title="上传文件"
        :visible.sync="uploaDialogVisible"
        :before-close="closeUploaDialog"
        :close-on-click-modal="false"
        :append-to-body="true"
        :style="cssVars">
        <div>
          <el-form :inline="true" ref="ruleForm" :model="form" :rules="rules" class="form-content">
            <el-form-item label="报告期年度" class="line-form-item" prop="cbyear">
              <el-date-picker
                type="year"
                v-model="form.cbyear"
                placeholder="">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="报告期类型" class="line-form-item" prop="bgtypeCode">
              <el-select v-model="form.bgtypeCode" placeholder="">
                <el-option
                  v-for="item in financeRtTypeEnum"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="财务准则" prop="standardId">
              <el-select v-model="form.standardId" placeholder="">
                <el-option
                  v-for="item in financialStandards"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="" class="upload-form-item">
              <el-upload
                ref="upload"
                class="upload-box"
                drag
                :limit="1"
                :file-list="fileList"
                :action="uploadUrl"
                :before-upload="handleBeforeUpload"
                :on-remove="handleUploadremove"
                :on-error="handleUploadError"
                :on-success="handleChange"
                :on-exceed="handleExceed">
                <i class="el-icon-plus"></i>
                <div class="el-upload__text">点击或拖拽上传</div>
                <div class="el-upload__tip" slot="tip">注：可支持PDF、XLS、XLSX文件上传，只支持上传单个文件，单个文件小于50M</div>
              </el-upload>

              <div class="select-page-box" v-if="fileList.length && fileList[0].type.indexOf('pdf')!==-1">
                <div class="select-page">
                  <p class="text">选择识别页<i class="must-item">（必选）</i></p>
                  <p class="page">
                    <el-checkbox class="select-all" v-model="checkAll" @change="checkAllChange">全选</el-checkbox>
                    <el-input v-model="pageStart" placeholder="页"></el-input>
                    <span>—</span>
                    <el-input v-model="pageEnd" placeholder="页"></el-input>
                    <el-button type="primary" @click="filterPic">筛选</el-button>
                  </p>
                </div>
                <el-checkbox-group class="checkbox-group" v-model="checkboxGroup" @change="checkPicChange">
                  <el-checkbox :label="item" v-for="(item, index) in base64List" :key="index">
                    <div class="image-box">
                      <el-image
                          style="width: 130px; height: 194px"
                          fit="fill"
                          :src="item"
                          :preview-src-list="viewPicList"
                          @click.prevent="viewPDFIMG(item)">
                      </el-image>
                      <p class="image-view">
                        <el-image
                          style="width: 32px; height: 32px; opacity: 0;"
                          fit="fill"
                          :src="item"
                          :preview-src-list="viewPicList"
                          @click.prevent="viewPDFIMG(item)">
                        </el-image>
                      </p>
                    </div>
                    <p class="number">{{index+1}}</p>
                  </el-checkbox>
                </el-checkbox-group>
              </div>
            </el-form-item>
          </el-form>
          
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closeUploaDialog">取消</el-button>
          <el-button type="primary" @click="onSubmit">开始识别</el-button>
        </span>
      </el-dialog>

      <!-- 进度条 -->
      <el-dialog
        class="progress-dialog"
        :visible.sync="progressDialogVisible"
        :close-on-click-modal="false"
        :show-close="false"
        :append-to-body="true"
        :style="cssVars">
        <div>
          <el-progress type="circle" :percentage="progress"></el-progress>
          <p>财报识别中......</p>
        </div>
      </el-dialog>
    </div>

    <!-- 识别页编辑 -->
    <el-dialog
      class="edit-dialog"
      :visible.sync="editDialogVisible"
      :close-on-click-modal="false"
      :append-to-body="true"
      :style="cssVars"
      :before-close="closeEditDialog">
      <identify
        :invoke="invoke"
        :editData="editData"
        :themeColor="themeColor"
        :identifyDataBack="identifyDataBack"
        :editDialogVisible="editDialogVisible">
      </identify>
    </el-dialog>
    
  </div>
</template>

<script>
import identify from './identify.vue'
  export default {
    components: {
      identify
    },
    props: {
      initData: Array,
      invoke: Function,
      themeColor: String,
      allBase64List: Array,     // 图片列表
      identifyData: Object,     // 识别数据
      subTableAllData: Object,  // 子表格所有数据
      financialStandards: Array,// 财务准则列表
      apiCallBackStatusArr: Array,
    },
    computed: {
      cssVars() {
        return {
          "--themeColor": this.themeColor
        }
      }
    },
    data() {
      return {
        curfinType: 'all',// 当前财报类型
        subfinType: '',  // 当前子表格的财报类型
        finceName: '',  // 财报名称搜索
        cbyear: '',    // 财报年度
        bgtypeCode: 'all', // 报告期code
        pages: 0,
        total: 0,
        pageNum: 1,
        pageSize: 5,
        editDialogVisible: false,
        uploaDialogVisible: false,
        progressDialogVisible: false,
        identifyDataBack: {},
        pageInitData: [],    // 分页后的表格数据
        pageInitAllData: [],// 页面初始化时表格数据
        subTableData: {},  // 子表格数据
        expandRow: [],    // 展开的行数组
        currentExpandRow: '',// 当前展开的行
        firstExpand: true,  // 是否第一次展开
        hasSubTableData: false,// 子表格是否有数据
        finNameList: {
          tab_balance: '资产负债表',
          tab_income: '利润表',
          tab_cash: '现金流量表'
        },
        financeRtTypeEnum: [ // 报告期类型枚举
          {code: 'year', name: '年报'},
          {code: 'quarter3', name: '三季报'},
          {code: 'half', name: '中报'},
          {code: 'quarter', name: '一季报'}
        ],
        financeTypeEnum: [ // 财报类型枚举
          {code: 'all', name: '全部'},
          {code: 'balance', name: '资产负债表'},
          {code: 'profit', name: '利润表'},
          {code: 'cash', name: '现金流量表'}
        ],
        editData: {},
        pageStart: '',
        pageEnd: '',
        form: {
          standardId: '', //财务准则ID
          cbyear: '',     //财报年度，需传时间戳
          bgtypeCode : '' //报告期code，参照上述枚举类
        },
        checkboxGroup: [],
        viewPicList: [],
        base64List: [],
        uploadFileUrl: '', // 上传的图片服务器地址
        fileType: ['xlsx', 'xls','pdf'],
        fileSize: 50,
        progress: 0, // 进度条
        fileList: [],
        checkAll: false,
        tableFlag: false, // 加个标识v-if让table强制渲染
        uploadUrl: window.location.origin + '/ierp/attachment/uploadFile.do',
        rules: {
          cbyear: [
            { required: true, message: '请输入', trigger: 'change' }
          ],
          standardId: [
            { required: true, message: '请输入', trigger: 'change' }
          ],
          bgtypeCode: [
            { required: true, message: '请输入', trigger: 'change' }
          ]
        },
        callBackList: null
      }
    },
    watch: {
      initData(val) {
        this.initHandleData()
      },
      subTableAllData(val) {
        this.subTableAllData = val
        this.subfinType = val.tab_income ? 'tab_income' : val.tab_balance ? 'tab_balance' : 'tab_cash'
        this.subTableData = this.subTableAllData[this.subfinType]
        this.hasSubTableData = true
      },
      identifyData(val) {
        if (val && val.status === 100) {
          this.progressDialogVisible = false
          this.editDialogVisible = true
          this.progress = 0
          setTimeout(() => {
            this.identifyDataBack = val
          }, 200)
        } else {
          this.editDialogVisible = false
        }
      },
      allBase64List(val) {
        this.base64List = val
      },
      apiCallBackStatusArr(val) {
        val.forEach((item, i)=> {
          //保存后回调
          if(item.eventName === 'finance_event_task_save') {
            this.editDialogVisible = false;
            this.identifyDataBack = {};
            this.editData = {};
            this.$message({
              message: '恭喜你，保存成功',
              type: 'success'
            });
            this.financeEventSearch();
          }
          this.apiCallBackStatusArr.splice(i, 1)
        })
      },
      deep: true,
      immediate: true
    },
    mounted() {

      // 初始化数据
      this.initHandleData()

      // 获取可用的财务准则列表
      this.invoke('finance_event_standard_list', {})

    },
    methods: {
      initHandleData() {
        this.pageInitALLData = this.initData // 页面初始化数据
        this.total = this.pageInitALLData.length
        this.pages = Math.ceil(this.total / this.pageSize)
        this.getTableList()
        this.tableFlag = true
      },
      // 点击财务类型
      clickFinType(code) {
        this.curfinType = code
        this.tableFlag = false
        this.expandRow = []
        this.financeEventSearch()
      },
      // 财报条件搜索
      financeEventSearch() {
        this.tableFlag = true
        let params = {
          name: this.finceName,            //财报名称模糊检索
          cbtypeCode: this.curfinType,     //财报类型切换，若为全部，在不用传，参照上述枚举类
          cbyear: Date.parse(this.cbyear), //财报年度，需传时间戳
          bgtypeCode: this.bgtypeCode      //报告期code，参照上述枚举类
        }
        for (const key in params) {
          if (!params[key] || params[key]==='all') {
            delete params[key]
          }
        }
        this.invoke('finance_event_search', params)
      },
      // 前端分页
      getTableList() {
        const self = this;
        const p = self.pageNum;
        const e = p * self.pageSize > self.total ? self.total : p * self.pageSize;
        self.pageInitData = self.pageInitALLData.slice((p - 1) * self.pageSize, e);
      },
      // 处理分页
      handPagination(num) {
        this.pageNum = num;
        this.getTableList();
      },
      // 处理分页size
      handPaginationSize(num) {
        this.pageSize = num;
        this.getTableList();
      },
      // 点击子页财务类型
      clickSubFinType(code) {
        this.subfinType = code
        this.subTableData = this.subTableAllData[this.subfinType]
      },
      // 图片放大预览
      viewPDFIMG(val) {
        this.viewPicList = []
        this.viewPicList.push(val)
      },
      // 上传前校检格式和大小
      handleBeforeUpload (file) {
        // 校检文件类型
        if (this.fileType) {
          let fileExtension = ''
          if (file.name.lastIndexOf('.') > -1) {
            fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1)
          }
          const isTypeOk = this.fileType.some((type) => {
            if (file.type.indexOf(type) > -1) return true
            if (fileExtension && fileExtension.indexOf(type) > -1) return true
            return false
          })
          if (!isTypeOk) {
            this.$message({
              showClose: true,
              message: `文件格式不正确, 请上传${this.fileType.join('/')}格式文件!`,
              type: 'error'
            })
            return false
          }
        }
        // 校检文件大小
        if (this.fileSize) {
          const isLt = file.size / 1024 / 1024 < this.fileSize
          if (!isLt) {
            this.$message({
              showClose: true,
              message: `上传文件大小不能超过 ${this.fileSize} MB!`,
              type: 'error'
            })
            return false
          }
        }
        this.fileList.push(file)
        return true
        
      },
      // 文件个数超出
      handleExceed () {
        this.$message({
          showClose: true,
          message: '上传文件数量不能超过1个!',
          type: 'error'
        })
      },
      // 上传成功
      handleChange(response, file) {
        if (response.status === 'success') {
          if (file.type.indexOf('pdf')!==-1) {
            // PDF文件转图片list
            let params = {
              fileName: file.name,
              fileUrl: response.url
            }
            this.invoke('finance_event_pdf_image', params)
          }
        }
      },
      // 上传失败
      handleUploadError (err) {
        this.$message({
          showClose: true,
          message: '上传失败，请重试!',
          type: 'error'
        })
      },
      // 移除文件
      handleUploadremove() {
        this.fileList = []
        this.pageStart = this.pageEnd = ''
        this.checkAll = false
        this.checkboxGroup = this.viewPicList = this.base64List = []
      },
      // 选择图片
      checkPicChange(val) {
        let checkedCount = val.length;
        this.checkAll = checkedCount === this.base64List.length;
      },
      // 全选
      checkAllChange(val) {
        this.checkboxGroup = val ? this.base64List : [];
      },
      // 筛选图片
      filterPic() {
        this.base64List = this.allBase64List.slice((this.pageStart - 1), this.pageEnd)
      },
      // 展开行变化
      expandChange(row) {

        // 无数据时 第一次的表格渲染问题
        if (this.firstExpand) {
          this.firstExpand = false
          this.invoke('finance_event_task_byid', {textinTaskId: row.textinTaskId, number: row.number} )
          setTimeout(() => {
            this.expandChange(row)
          }, 1000)
          return
        }
        
        // 点击当前行返回
        if (this.currentExpandRow === row.textinTaskId && this.expandRow.length) {
          this.expandRow=[]
          return
        }

        // 展开行请求数据
        this.expandRow=[row.textinTaskId]
        this.currentExpandRow = row.textinTaskId
        this.invoke('finance_event_task_byid', {textinTaskId: row.textinTaskId, number: row.number} )
      },
      // 编辑
      editTableDate (row) {
        this.editDialogVisible = true
        this.editData = row
      },
      // 删除
      deleteTableDate (row) {
        const params = {
          number: row.number,
          textinTaskId: row.textinTaskId
        };
        let self = this
        self.$confirm('确认删除吗？', '确认', {
          confirmButtonText: '确认',
          cancelButtonText: '取消',
          customClass: 'confirmCustomBox',
          type: 'warning',
        }).then(() => {
          self.invoke('finance_event_del_bynum', params)

          self.pageInitALLData.forEach((v) => {
            if (row.textinTaskId === v.textinTaskId) {
              self.pageInitALLData.splice(self.pageInitALLData.indexOf(v), 1);
            }
          });
          self.total -= 1;
          self.pages = Math.ceil(self.total / self.pageSize);
          if (self.pageNum > self.pages) {
            self.pageNum = self.pages > 0 ? self.pages : 1;
          }
          self.getTableList();
        }).catch(() => {
        })
      },
      // 添加财报
      uploadFile() {
        this.uploaDialogVisible = true
      },
      // 关闭上传弹窗
      closeUploaDialog() {
        this.fileList = []
        this.$refs.ruleForm.resetFields()
        this.pageStart = this.pageEnd = ''
        this.checkAll = false
        this.checkboxGroup = this.viewPicList = this.base64List = []
        this.uploaDialogVisible = false
      },
      // 关闭编辑弹窗
      closeEditDialog() {
        this.editData = {}
        this.identifyDataBack = {}
        this.editDialogVisible = false
      },
      // 开始识别
      onSubmit() {
        this.$refs.ruleForm.validate((valid) => {
          if (valid) {
            if (!this.fileList.length) {
              this.$message({
                showClose: true,
                message: '请上传文件!',
                type: 'error'
              })
              return false
            }
            
            if (this.fileList.length && this.fileList[0].type.indexOf('pdf')!==-1 && !this.checkboxGroup.length) {
              this.$message({
                showClose: true,
                message: '请先选择识别页!',
                type: 'error'
              })
              return false
            }
            let params = {}
            
            if (this.fileList.length && this.fileList[0].type.indexOf('pdf')!==-1) {

              params = {
                  ...this.form,
                  fileName: this.fileList[0].name
              }

              let list = []
              this.checkboxGroup.forEach(item => {
                let text = 'data:image/*;base64,'
                let index = item.lastIndexOf(text) + text.length-1;
                item = item.substring(index+1, item.length);
                list.push(item)
              })
              params.base64List = list
              
            } else {
              params = {
                  ...this.form,
                  fileName: this.fileList[0].name,
                  fileUrl: this.fileList[0].response.url
              }
            }
            params.cbyear =  Date.parse(params.cbyear)

            this.invoke('finance_event_task_ocr', params)
            this.closeUploaDialog()
            this.progressDialogVisible = true

            // 进度条出现
            const self = this
            let num = 0
            this.progress = 0//进度条的值
            self.timer = setInterval(()=>{
              if(num > 90){
                clearInterval(self.timer)
                self.timer = null
                num = 99
                self.progress = num
                /* self.progressDialogVisible = false // 联调后删掉
                self.editDialogVisible = true */
              } else {
                num += Math.floor(Math.random()*10+1)
                self.progress = num
              }
            },500)

          } else {
            return false
          }
        })
      },
      /**
       * 格式化时间戳
       * timestamp {时间戳}
       * @return {年月日时分秒}
       */
      parseTime (timestamp, formater) {
        // eslint-disable-next-line
        Date.prototype.Format = function(fmt) {
          const o = {
            'M+': this.getMonth() + 1, // 月份
            'D+': this.getDate(), // 日
            'h+': this.getHours(), // 小时
            'm+': this.getMinutes(), // 分
            's+': this.getSeconds(), // 秒
            'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
            S: this.getMilliseconds() // 毫秒
          }
          if (/(Y+)/.test(fmt)) {
            fmt = fmt.replace(
              RegExp.$1,
              (this.getFullYear() + '').substr(4 - RegExp.$1.length)
            )
          }
          for (const k in o) {
            if (new RegExp('(' + k + ')').test(fmt)) {
              fmt = fmt.replace(
                RegExp.$1,
                RegExp.$1.length === 1
                  ? o[k]
                  : ('00' + o[k]).substr(('' + o[k]).length)
              )
            }
          }
          return fmt
        }
        const _formater = formater || 'YYYY-MM-DD hh:mm:ss'
        let date = ''
        if (timestamp) {
          date = new Date(timestamp).Format(_formater) || ''
        }
        return date
      }
    }
  }
  

</script>

<style  lang="less"  scoped>
/* 重置element样式 */
.is-error, .is-success {
  background: transparent!important;
}
.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner {
  background: var(--themeColor)!important;
  border-color: var(--themeColor)!important;
}
.el-button--text {
  color: var(--themeColor);
  &:hover {
    color: var(--themeColor);
  }
}

.page-main {
  padding: 20px;
  width: 100%;
  background: #fff;
  margin: 0 auto;
}
.el-icon-circle-close {
  color: #FB2323;
}
.el-icon-warning-outline {
  color: #FF991C;
}
.el-icon-circle-check {
  color: #1BA854;
}
.report-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.report-header-left {
  display: flex;
}
.report-header-right {
  display: flex;
  /deep/ .el-input {
    margin-left: 20px;
  }
  /deep/ .el-input, /deep/ .el-input__inner {
    width: 140px;
    height: 24px;
    font-size: 12px;
  }
  /deep/ .el-input__icon {
    line-height: 24px;
  }
}
.search-list {
  display: flex;
}
.search-item {
  width: 76px;
  height: 24px;
  line-height: 24px;
  font-size: 12px;
  text-align: center;
  color: var(--themeColor);
  border: 1px solid var(--themeColor);
  border-right: none;
  cursor: pointer;
  &:first-of-type {
    border-radius: 2px 0px 0px 2px;
  }
  &:last-of-type {
    border-radius: 0px 2px 2px 0px;
    border-right: 1px solid var(--themeColor);
  }
  &.active {
    color: #fff;
    background: var(--themeColor);
  }
}
.add-report {
  display: flex;
  flex-direction: row-reverse;
  margin-bottom: 14px;
  .el-button {
    width: 84px;
    height: 28px;
    padding: 0;
    line-height: 28px;
    font-size: 12px;
    background: var(--themeColor);
    border-color: var(--themeColor);
  }
}
.form-content {
  /deep/ .el-form-item__label{
    display: block;
    text-align: left;
  }
  /deep/ .el-input {
    font-size: 12px;
  }
  /deep/ .el-input__inner {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #999;
  }
  /deep/ .el-checkbox-group {
    padding: 20px 0;
    background: #F5F5F5;
    max-height: 490px;
    overflow-y: auto;
  }
}
.checkbox-group {
  /deep/ .el-checkbox {
    padding: 5px;
    background: #fff;
    width: 140px;
    height: 204px;
    margin: 0 10px;
  }
  /deep/ .el-checkbox__label {
    padding-left: 0;
  }
  /deep/ .el-checkbox__input {
    position: absolute;
    right: 4px;
    top: 4px;
  }
}
.select-page-box {
  .select-all {
    margin-right: 20px;
    padding-left: 5px;
    font-size: 12px;
  }
  .image-box {
    position: relative;
    &:hover {
      .image-view {
        display: block;
      }
    }
  }
  .image-view {
    display: none;
    width: 32px;
    height: 32px;
    background: url('../assets/image-view.svg') no-repeat;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
  }
  .number {
    font-size: 14px;
    margin-top: 6px;
    text-align: center;
    color: #212121;
  }
}
.select-page {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  
  .page {
    color: #D9D9D9;
  }
  /deep/ .el-button {
    width: 60px;
    height: 24px;
    line-height: 24px;
    border-radius: 2px;
    padding: 0;
    margin-left: 12px;
    vertical-align: middle;
    font-size: 12px;
    background: var(--themeColor);
    border-color: var(--themeColor);
  }
  /deep/ .el-input{
    width: 48px;
  }
  /deep/ .el-input__inner {
    border-radius: 0;
    border: 1px solid #D9D9D9;
    text-align: center;
    height: 24px;
  }
  .text {
    font-size: 16px;
    font-weight: normal;
    line-height: 24px;
    color: #212121;
  }
  .must-item {
    font-size: 12px;
    line-height: 18px;
    font-style: normal;
    color: #666666;
  }
}

.finance-data {
  .el-pagination {
      padding: 5px;
      border: 1px solid #D9D9D9;
      border-top: none;
      text-align: right;
      /deep/ .el-input, /deep/ .el-input__inner {
        height: 24px;
        line-height: 24px;
      }
      /deep/ .el-input__icon {
        line-height: 24px;
      }
  }
  /deep/ .el-table {
    border: 1px solid #D9D9D9;
    border-right: 1px solid #D9D9D9;
    .el-table__cell {
        padding: 0;
        height: 40px;
    }
    .cell{
      font-size: 12px;
      color: #212121;
      font-weight: normal;
    }
    td.el-table__cell, th.el-table__cell.is-leaf {
        border-bottom: 1px solid #D9D9D9;
    }
    .el-table__header-wrapper {
      td.el-table__cell, th.el-table__cell.is-leaf {
          background: #F2F2F2;
      }
    }
    .el-input__inner {
        height: 32px;
        border-radius: 0;
        border-color: var(--themeColor);
    }
  }
}

.subdata-list {
  padding: 20px 28px;
  .search-list {
    margin-bottom: 12px;
  }
  .search-item {
    color: #212121;
    border-color: #D9D9D9;
    &.active {
      color: var(--themeColor);
      background: #fff;
      border: 1px solid var(--themeColor);
    }
  }
}

.table-list {
  width: 100%;
  border: 1px solid #D9D9D9;
  max-height: 425px;
  overflow-y: auto;
}
.table-list-nodata {
  text-align: center;
  font-size: 12px;
  line-height: 18px;
}
.table-title {
  height: 34px;
  line-height: 34px;
  background: #F2F2F2;
  display: flex;
  padding: 0 12px;
}
.table-data {
  height: 40px;
  line-height: 40px;
  background: #fff;
  display: flex;
  padding: 0 12px;
  border-top: 1px solid #D9D9D9;
  &:last-of-type {
    border-bottom: 1px solid #D9D9D9;
  }
}
.table-title-item, .table-data-item  {
  width: 33.3%;
  text-align: right;
  font-size: 12px;
  color: #212121;
  &:first-of-type {
    text-align: left;
  }
  /deep/.el-input, .table-text {
    width: 80%;
    height: 40px;
    display: inline-block;
    vertical-align: middle;
  }
  /deep/.el-input__inner {
      height: 32px;
      border-radius: 0;
      border-color: var(--themeColor)
  }
}
.add-report-dialog {
  /deep/ .el-dialog {
    width: 900px;
  }
  .line-form-item {
    margin-right: 100px;
  }
  .upload-form-item, /deep/ .el-upload-dragger {
    width: 810px;
    margin-top: 10px;
    margin-bottom: 0;
  }
  /deep/ .el-upload-dragger {
    height: 80px;
    background: #FAFAFA;
    border: 1px dashed #E5E5E5;
  }
  /deep/ .el-icon-plus {
    color: #666666;
    font-size: 18px;
    margin-top: 15px;
  }
  /deep/ .el-upload__text {
    font-size: 14px;
    color: #999999;
    margin-top: -18px;
  }
  /deep/ .el-upload__tip {
    margin-top: -17px;
    text-align: center;
    color: #999999;
  }
  /deep/ .el-dialog__header {
      padding: 0;
      height: 50px;
      line-height: 50px;
      text-indent: 20px;
      border-bottom: 1px solid #D9D9D9;
  }
  /deep/ .el-dialog__title {
    color: #212121;
  }
  /deep/ .el-dialog__body {
    padding: 30px 30px 30px 40px;
    min-height: 360px;
    border-bottom: 1px solid #D9D9D9;
  }
  /deep/ .el-form-item__label {
    font-size: 12px;
    color: #666666;
  }
  /deep/ .el-dialog__footer {
    height: 50px;
    padding: 0;
    line-height: 50px;
    text-align: center;
  }
}
.progress-dialog {
  /deep/ .el-dialog {
    width: 320px;
    height: 200px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto!important;
  }
  /deep/ .el-dialog__header {
    display: none;
  }
  /deep/ .el-dialog__body {
    text-align: center;
    padding: 28px 0 0 0;
  }
}
.edit-dialog {
  /deep/ .el-dialog {
    width: 95%;
    margin-top: 15px!important;
  }
  /deep/ .el-dialog__header {
    padding: 0;
  }
  /deep/ .el-dialog__body {
    padding: 0;
  }
}
.dialog-footer {
  /deep/ .el-button {
    width: 60px;
    height: 28px;
    border-radius: 2px;
    font-size: 12px;
    line-height: 28px;
    color: #212121;
    padding: 0;
  }
  /deep/ .el-button--primary {
    color: #fff;
    background: var(--themeColor);
    border-color: var(--themeColor);
  }
}
</style>